<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/vectrics.tld" prefix="vectrics" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<%@ page import="org.vectrics.user.UserAuthService" %>
<%@ page import="org.vectrics.provider.*" %>
<%@ page import="org.vectrics.user.*" %>
<%@ page import="org.vectrics.hibernate.ThreadProperties" %>
<%@ page import="org.vectrics.domain.Domain" %>
<%@ page import="org.vectrics.common.util.*" %>
<%@ page import="org.vectrics.struts.*" %>
<%
	Request vectricsRequest = HttpRequestConverter.convertRequest(request);
	String domainId = ThreadProperties.getUriDomainId();
	Domain domain = ThreadProperties.getDomain();
	String uploadResumeHref = "/hrs-public/profile/" + domainId + "/resume/upload.do";
	Person person = CoreServiceLocator.getUserAuthService().getAuthorizedPerson(vectricsRequest);

	if (person == null) {
		person = CoreServiceLocator.getPersonService().findPersonWithUserName(domain, request.getParameter("userName"));
	}
	
	User user = person.getUser();
	String userId = null;
	if (user != null) {
		userId = person.getId().toString();		
	}
	else {
%>
		<h1>No Authorized User Logged In</h1>
<%
	}

	String resumeName = 
		CoreServiceLocator.getPhraseProvider().getMessage("phrase.resume.name.default", request.getLocale());
	resumeName += " " + CoreServiceLocator.getDateFormat().getDateFormatRoundToDay(request.getLocale()).format(DateSync.getCurrentTime());
%>
<vectrics:errors debug="false"/>

<table>
	<tr>
		<td>
			<form action="<%=uploadResumeHref%>" method="POST" enctype="multipart/form-data" >
				<input type="hidden" name="userId" value="<%=userId%>">
				<table width="400" cellspacing="3">
					<tr>	
						<td><font class="stdFont"><b>Description</b></font></td>
						<td><font class="stdFont"><b>File</b></font></td>
					</tr>
					<tr>
						<td>
							<input type="text" name="name" value="<%=resumeName%>" class="formEditClass">
						</td>
						<td>
							<input type="file" name="theFile" class="formEditClass">
						</td>
					</tr>
				</table>
				
				<vectrics:formButton 
						name="submit" 
						code="public.button.wide" 
						phraseCode="button.resume.upload"/>
			</form>
			
			<table width="270">
				<tr>
					<td>
						<font class="stdFont">Click the 'Browse' button to select a Word resume saved on your computer.&nbspThen press the 'Upload' button to finish the upload.</font>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>



